/**
 * Created with JetBrains WebStorm.
 * User: Steven
 * Date: 25-4-13
 * Time: 22:00
 * To change this template use File | Settings | File Templates.
 */

/**
 * Character Class. Description to come.
 *
 * @param name
 * @param specialization
 * @constructor
 */
function Class(name, specialization)
{
    this.id = -1; // Unique Class ID
    this.name = name;
    this.specialization = specialization;
    this.favoredAttributeOne = null;
    this.favoredAttributeTwo = null;
    this.majorSkillTypes = {};
}

Class.prototype.addMajorSkillType = function(skillType)
{
    this.majorSkillTypes[skillType] = 20; // Default increase value for
};

Class.prototype.hasMajorSkillType = function(skillType)
{
    return skillType in this.majorSkillTypes;
};

Class.prototype.getMajorSkillModifier = function(skillType)
{
    return this.hasMajorSkillType(skillType) ? this.majorSkillTypes[skillType] : 0;
};

Class.prototype.hasFavoredAttribute = function(attributeType)
{
    return this.favoredAttributeOne == attributeType || this.favoredAttributeTwo == attributeType;
};

Class.prototype.getMajorSkillTypes = function()
{
    return Object.keys(this.majorSkillTypes);
};

Class.prototype.toArray = function()
{
    var classArray = {};
    classArray["favoredAttributeOne"] = this.parent.skillSet.getSkill(this.favoredAttributeOne).id;
    classArray["favoredAttributeTwo"] = this.parent.skillSet.getSkill(this.favoredAttributeTwo).id;

    //var
};

/*
 * Class constructor container
 */
Class.classes = [];

Class.classes.push(Acrobat);
Acrobat.prototype = new Class("Acrobat", new StealthSpecialization());
Acrobat.prototype.constructor = Class;
function Acrobat()
{
    this.id = 0;
    this.favoredAttributeOne = AttributeTypes.agility;
    this.favoredAttributeTwo = AttributeTypes.endurance;
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.marksmanship);
    this.addMajorSkillType(SkillTypes.security);
    this.addMajorSkillType(SkillTypes.sneak);
    this.addMajorSkillType(SkillTypes.acrobatics);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.speechcraft);
}

Class.classes.push(Agent);
Agent.prototype = new Class("Agent", new StealthSpecialization());
Agent.prototype.constructor = Class;
function Agent()
{
    this.id = 1;
    this.favoredAttributeOne = AttributeTypes.personality;
    this.favoredAttributeTwo = AttributeTypes.agility;
    this.addMajorSkillType(SkillTypes.acrobatics);
    this.addMajorSkillType(SkillTypes.illusion);
    this.addMajorSkillType(SkillTypes.marksmanship);
    this.addMajorSkillType(SkillTypes.mercantile);
    this.addMajorSkillType(SkillTypes.security);
    this.addMajorSkillType(SkillTypes.sneak);
    this.addMajorSkillType(SkillTypes.speechcraft);
}

Class.classes.push(Archer);
Archer.prototype = new Class("Archer", new CombatSpecialization());
Archer.prototype.constructor = Class;
function Archer()
{
    this.id = 2;
    this.favoredAttributeOne = AttributeTypes.agility;
    this.favoredAttributeTwo = AttributeTypes.strength;
    this.addMajorSkillType(SkillTypes.armorer);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.blunt);
    this.addMajorSkillType(SkillTypes.handtohand);
    this.addMajorSkillType(SkillTypes.lightarmor);
    this.addMajorSkillType(SkillTypes.marksmanship);
    this.addMajorSkillType(SkillTypes.sneak);
}

Class.classes.push(Assassin);
Assassin.prototype = new Class("Assassin", new StealthSpecialization());
Assassin.prototype.constructor = Class;
function Assassin()
{
    this.id = 3;
    this.favoredAttributeOne = AttributeTypes.speed;
    this.favoredAttributeTwo = AttributeTypes.intelligence;
    this.addMajorSkillType(SkillTypes.acrobatics);
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.lightarmor);
    this.addMajorSkillType(SkillTypes.marksmanship);
    this.addMajorSkillType(SkillTypes.security);
    this.addMajorSkillType(SkillTypes.sneak);
}

Class.classes.push(Barbarian);
Barbarian.prototype = new Class("Barbarian", new CombatSpecialization());
Barbarian.prototype.constructor = Class;
function Barbarian()
{
    this.id = 4;
    this.favoredAttributeOne = AttributeTypes.strength;
    this.favoredAttributeTwo = AttributeTypes.speed;
    this.addMajorSkillType(SkillTypes.armorer);
    this.addMajorSkillType(SkillTypes.athletics);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.blunt);
    this.addMajorSkillType(SkillTypes.handtohand);
    this.addMajorSkillType(SkillTypes.lightarmor);
}

Class.classes.push(Bard);
Bard.prototype = new Class("Bard", new StealthSpecialization());
Bard.prototype.constructor = Class;
function Bard()
{
    this.id = 5;
    this.favoredAttributeOne = AttributeTypes.personality;
    this.favoredAttributeTwo = AttributeTypes.intelligence;
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.illusion);
    this.addMajorSkillType(SkillTypes.lightarmor);
    this.addMajorSkillType(SkillTypes.mercantile);
    this.addMajorSkillType(SkillTypes.speechcraft);
}

Class.classes.push(Battlemage)
Battlemage.prototype = new Class("Battlemage", new MagicSpecialization());
Battlemage.prototype.constructor = Class;
function Battlemage()
{
    this.id = 6;
    this.favoredAttributeOne = AttributeTypes.strength;
    this.favoredAttributeTwo = AttributeTypes.intelligence;
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.alteration);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.blunt);
    this.addMajorSkillType(SkillTypes.conjuration);
    this.addMajorSkillType(SkillTypes.destruction);
    this.addMajorSkillType(SkillTypes.mysticism);
}

Class.classes.push(Crusader)
Crusader.prototype = new Class("Crusader", new CombatSpecialization());
Crusader.prototype.constructor = Class;
function Crusader()
{
    this.id = 7;
    this.favoredAttributeOne = AttributeTypes.strength;
    this.favoredAttributeTwo = AttributeTypes.willpower;
    this.addMajorSkillType(SkillTypes.athletics);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.blunt);
    this.addMajorSkillType(SkillTypes.destruction);
    this.addMajorSkillType(SkillTypes.handtohand);
    this.addMajorSkillType(SkillTypes.heavyarmor);
    this.addMajorSkillType(SkillTypes.restoration);
}

Class.classes.push(Healer);
Healer.prototype = new Class("Healer", new MagicSpecialization());
Healer.prototype.constructor = Class;
function Healer()
{
    this.id = 8;
    this.favoredAttributeOne = AttributeTypes.personality;
    this.favoredAttributeTwo = AttributeTypes.willpower;
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.alteration);
    this.addMajorSkillType(SkillTypes.destruction);
    this.addMajorSkillType(SkillTypes.illusion);
    this.addMajorSkillType(SkillTypes.mercantile);
    this.addMajorSkillType(SkillTypes.restoration);
    this.addMajorSkillType(SkillTypes.speechcraft);
}

Class.classes.push(Knight);
Knight.prototype = new Class("Knight", new CombatSpecialization());
Knight.prototype.constructor = Class;
function Knight()
{
    this.id = 9;
    this.favoredAttributeOne = AttributeTypes.strength;
    this.favoredAttributeTwo = AttributeTypes.personality;
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.blunt);
    this.addMajorSkillType(SkillTypes.handtohand);
    this.addMajorSkillType(SkillTypes.heavyarmor);
    this.addMajorSkillType(SkillTypes.illusion);
    this.addMajorSkillType(SkillTypes.speechcraft);
}

Class.classes.push(Mage);
Mage.prototype = new Class("Mage", new MagicSpecialization());
Mage.prototype.constructor = Class;
function Mage()
{
    this.id = 10;
    this.favoredAttributeOne = AttributeTypes.intelligence;
    this.favoredAttributeTwo = AttributeTypes.willpower;
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.alteration);
    this.addMajorSkillType(SkillTypes.conjuration);
    this.addMajorSkillType(SkillTypes.destruction);
    this.addMajorSkillType(SkillTypes.illusion);
    this.addMajorSkillType(SkillTypes.mysticism);
    this.addMajorSkillType(SkillTypes.restoration);
}

Class.classes.push(Monk);
Monk.prototype = new Class("Monk", new StealthSpecialization());
Monk.prototype.constructor = Class;
function Monk()
{
    this.id = 11;
    this.favoredAttributeOne = AttributeTypes.agility;
    this.favoredAttributeTwo = AttributeTypes.willpower;
    this.addMajorSkillType(SkillTypes.acrobatics);
    this.addMajorSkillType(SkillTypes.alteration);
    this.addMajorSkillType(SkillTypes.athletics);
    this.addMajorSkillType(SkillTypes.handtohand);
    this.addMajorSkillType(SkillTypes.marksmanship);
    this.addMajorSkillType(SkillTypes.security);
    this.addMajorSkillType(SkillTypes.sneak);
}

Class.classes.push(Nightblade);
Nightblade.prototype = new Class("Nightblade", new MagicSpecialization());
Nightblade.prototype.constructor = Class;
function Nightblade()
{
    this.id = 12;
    this.favoredAttributeOne = AttributeTypes.willpower;
    this.favoredAttributeTwo = AttributeTypes.speed;
    this.addMajorSkillType(SkillTypes.acrobatics);
    this.addMajorSkillType(SkillTypes.alteration);
    this.addMajorSkillType(SkillTypes.athletics);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.destruction);
    this.addMajorSkillType(SkillTypes.lightarmor);
    this.addMajorSkillType(SkillTypes.restoration);
}

Class.classes.push(Pilgrim);
Pilgrim.prototype = new Class("Pilgrim", new StealthSpecialization());
Pilgrim.prototype.constructor = Class;
function Pilgrim()
{
    this.id = 13;
    this.favoredAttributeOne = AttributeTypes.personality;
    this.favoredAttributeTwo = AttributeTypes.endurance;
    this.addMajorSkillType(SkillTypes.armorer);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.blunt);
    this.addMajorSkillType(SkillTypes.lightarmor);
    this.addMajorSkillType(SkillTypes.mercantile);
    this.addMajorSkillType(SkillTypes.security);
    this.addMajorSkillType(SkillTypes.speechcraft);
}

Class.classes.push(Rogue);
Rogue.prototype = new Class("Rogue", new CombatSpecialization());
Rogue.prototype.constructor = Class;
function Rogue()
{
    this.id = 14;
    this.favoredAttributeOne = AttributeTypes.speed;
    this.favoredAttributeTwo = AttributeTypes.personality;
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.athletics);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.illusion);
    this.addMajorSkillType(SkillTypes.lightarmor);
    this.addMajorSkillType(SkillTypes.mercantile);
}

Class.classes.push(Scout);
Scout.prototype = new Class("Scout", new CombatSpecialization());
Scout.prototype.constructor = Class;
function Scout()
{
    this.id = 15;
    this.favoredAttributeOne = AttributeTypes.speed;
    this.favoredAttributeTwo = AttributeTypes.endurance;
    this.addMajorSkillType(SkillTypes.acrobatics);
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.armorer);
    this.addMajorSkillType(SkillTypes.athletics);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.lightarmor);
}

Class.classes.push(Sorcerer);
Sorcerer.prototype = new Class("Sorcerer", new MagicSpecialization());
Sorcerer.prototype.constructor = Class;
function Sorcerer()
{
    this.id = 16;
    this.favoredAttributeOne = AttributeTypes.intelligence;
    this.favoredAttributeTwo = AttributeTypes.endurance;
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.alteration);
    this.addMajorSkillType(SkillTypes.conjuration);
    this.addMajorSkillType(SkillTypes.destruction);
    this.addMajorSkillType(SkillTypes.heavyarmor);
    this.addMajorSkillType(SkillTypes.mysticism);
    this.addMajorSkillType(SkillTypes.restoration);
}

Class.classes.push(Spellsword);
Spellsword.prototype = new Class("Spellsword", new MagicSpecialization());
Spellsword.prototype.constructor = Class;
function Spellsword()
{
    this.id = 17;
    this.favoredAttributeOne = AttributeTypes.willpower;
    this.favoredAttributeTwo = AttributeTypes.endurance;
    this.addMajorSkillType(SkillTypes.alteration);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.destruction);
    this.addMajorSkillType(SkillTypes.heavyarmor);
    this.addMajorSkillType(SkillTypes.illusion);
    this.addMajorSkillType(SkillTypes.restoration);
}

Class.classes.push(Thief);
Thief.prototype = new Class("Thief", new StealthSpecialization());
Thief.prototype.constructor = Class;
function Thief()
{
    this.id = 18;
    this.favoredAttributeOne = AttributeTypes.speed;
    this.favoredAttributeTwo = AttributeTypes.agility;
    this.addMajorSkillType(SkillTypes.acrobatics);
    this.addMajorSkillType(SkillTypes.lightarmor);
    this.addMajorSkillType(SkillTypes.marksmanship);
    this.addMajorSkillType(SkillTypes.mercantile);
    this.addMajorSkillType(SkillTypes.security);
    this.addMajorSkillType(SkillTypes.sneak);
    this.addMajorSkillType(SkillTypes.speechcraft);
}

Class.classes.push(Warrior);
Warrior.prototype = new Class("Warrior", new CombatSpecialization());
Warrior.prototype.constructor = Class;
function Warrior()
{
    this.id = 19;
    this.favoredAttributeOne = AttributeTypes.strength;
    this.favoredAttributeTwo = AttributeTypes.endurance;
    this.addMajorSkillType(SkillTypes.armorer);
    this.addMajorSkillType(SkillTypes.athletics);
    this.addMajorSkillType(SkillTypes.blade);
    this.addMajorSkillType(SkillTypes.block);
    this.addMajorSkillType(SkillTypes.blunt);
    this.addMajorSkillType(SkillTypes.handtohand);
    this.addMajorSkillType(SkillTypes.heavyarmor);
}

Class.classes.push(Witchhunter);
Witchhunter.prototype = new Class("Witchhunter", new MagicSpecialization());
Witchhunter.prototype.constructor = Class;
function Witchhunter()
{
    this.id = 20;
    this.favoredAttributeOne = AttributeTypes.intelligence;
    this.favoredAttributeTwo = AttributeTypes.agility;
    this.addMajorSkillType(SkillTypes.alchemy);
    this.addMajorSkillType(SkillTypes.athletics);
    this.addMajorSkillType(SkillTypes.conjuration);
    this.addMajorSkillType(SkillTypes.destruction);
    this.addMajorSkillType(SkillTypes.marksmanship);
    this.addMajorSkillType(SkillTypes.mysticism);
    this.addMajorSkillType(SkillTypes.security);
}